//
//  ViewController.m
//  CordovaDemo
//
//  Created by zxl02 on 2020/7/28.
//  Copyright © 2020 CordovaDemo. All rights reserved.
//

#import "ViewController.h"
#import <CoreTelephony/CoreTelephonyDefines.h>
#import <CoreTelephony/CTCellularData.h>
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(@"运行成功...");
//    CTCellularData * cellularData  =[[CTCellularData alloc]init];
    [self isHaveInternetQX];
    // Do any additional setup after loading the view.
}
//手机联网权限检测（头文件）

//@import CoreTelephony;

-(void)isHaveInternetQX{

    //检查联网权限==系统会自动弹框提示无需自己弄==iOS9以后
    CTCellularData *cellularData = [[CTCellularData alloc]init];
    cellularData.cellularDataRestrictionDidUpdateNotifier =  ^(CTCellularDataRestrictedState state){
        //获取联网状态
        switch (state) {
                
            case kCTCellularDataRestricted:
                
                NSLog(@"kCT蜂窝数据限制");
                
                break;
                
            case kCTCellularDataNotRestricted:
                
                NSLog(@"kCT蜂窝数据不受限制的");
                
                break;
                
            case kCTCellularDataRestrictedStateUnknown:
                
                NSLog(@"kCT蜂窝数据限制状态未知");
                
                break;
                
            default:
                
                break;
                
        };
        
    };

}
@end
